﻿using System.ServiceModel;
using WebService4.MerchantService;

namespace WebService4
{
	public static class ServiceFactory
	{
		public class MerchantServiceTuple
		{
			public readonly ClientBase<MerchantService.MerchantService> Client;
			public readonly MerchantService.MerchantService Service;

			public MerchantServiceTuple(ClientBase<MerchantService.MerchantService> client, MerchantService.MerchantService service)
			{
				Client = client;
				Service = service;
			}
		}
		public static IGLKServiceImplementation CreateGlkService()
		{
			return new GLKTestServiceImplementation();
		}

		public static MerchantServiceTuple CreateMerchantService()
		{
			var mc = new MerchantServiceClient();

			//TODO вынести в параметры аутентификации
			mc.Endpoint.Behaviors.Add(new SecurityBehavior { UserName = "datakrat-api", Password = "datakrat" });
			return new MerchantServiceTuple(mc, mc);

		}
	}
}